<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
  <cpn1></cpn1>
  <cpn1></cpn1>
  <cpn1></cpn1>

  <hr />

  <cpn2></cpn2>
  <cpn2></cpn2>
  <cpn2></cpn2>
</div>

<!--方式1：script标签-->
<script type="text/x-template" id="cpn1">
  <div>
    <h2>我是标题1</h2>
    <p>我是内容1</p>
  </div>
</script>

<!--方式2：template标签-->
<template id="cpn2">
  <div>
    <h2>我是标题2</h2>
    <p>我是内容2</p>
  </div>
</template>

<script src="../js/vue.js"></script>
<script>
  // 注册一个全局组件
  Vue.component('cpn1', {
    template: '#cpn1'
  });

  Vue.component('cpn2', {
    template: '#cpn2'
  });

  const app = new Vue({
    el: '#app',
    data: {
      message: '你好'
    }
  });
</script>
</body>
</html>